package org.example.common.data;

import lombok.Data;

@Data
public class Rsp {
    private String code;
    private String message;
    private Object data;

    public static Rsp ok(CharSequence message){
        return build("success", message.toString(), null);

    }

    public static Rsp data(Object data){
        return build("success", "success", data);

    }

    private static Rsp build(CharSequence code, String message, Object data){

        Rsp rsp = new Rsp();

        rsp.setCode(code.toString());
        rsp.setMessage(message);
        rsp.setData(data);

        return rsp;

    }

}
